package com.dunshan.prometh;


import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCustomizer;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

/**
 * @author .dunshan
 * @program: dunshan-pef
 * @description: 启动类
 * @date 2021-09-23 21:37:56
 */
@SpringBootApplication
public class AppPrometheusMain {

    public static void main(String[] args) {
        SpringApplication.run(AppPrometheusMain.class, args);
    }

    /**
     * 配置是监控 jvm
     *
     * @param applicationName
     * @return
     */
    @Bean
    MeterRegistryCustomizer<MeterRegistry> configurer(@Value("${spring.application.name}") String applicationName) {
        return registry -> registry.config().commonTags("application", applicationName);
    }

}
